home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / UTILITY1 / MSWLGO35.ZIP / EXAMPLES / MIDI.WIN < prev    next >
Text File  |  1993-10-22  |  11KB  |  372 lines

  1. ;
  2. ; Function:
  3. ;
  4. ; This routine will simulate a MIDI keyboard
  5. ;
  6. ; To run:
  7. ;
  8. ; load "midi.win
  9. ; Call MIDI (or let it auto-execute)
  10. ;
  11. ; System requirements:
  12. ;
  13. ; You must have Windows 3.1 (or 3.0 with Multi-Media Extentions)
  14. ; You must have the correct driver loaded in Windows for your sound card.
  15. ; You must have a sound card.
  16. ;
  17. make "startup [midi]
  18.  
  19. to chan
  20. make "chan 17-scrollbarget "sc3
  21. staticupdate "st3 (list "Channel :chan)
  22. setfocus [MswLogo Screen]
  23. end
  24.  
  25. to changespeed
  26. make "recordspeed 60-scrollbarget "sspeed
  27. staticupdate "stspeed (list "Speed 60-:recordspeed)
  28. setfocus [MswLogo Screen]
  29. end
  30.  
  31. to dohelp
  32. drawkeys
  33. messagebox [Help] [\
  34. The picture drawn shows how your keyboard maps to notes\
  35. The keyboard key C is Middle C when the Octave is set to 3\
  36. The Main Window must have focus for keyboard to work\
  37. You may have to try different channels to get things to work\
  38. ]
  39. messagebox [Help] [\
  40. Velocity is how hard you hit the keys\
  41. Octave moves your keyboard up or down an octave\
  42. Volume sets the volume\
  43. Channel selects the channel (MIDI MAPPER is being used)\
  44. ]
  45. setfocus [MswLogo Screen]
  46. end
  47.  
  48. to drawkey :arg
  49. label :arg
  50. repeat 4 [fd 25 rt 90]
  51. fd 25
  52. end
  53.  
  54. to drawkeys
  55. cs
  56. pu
  57. setxy -200 0
  58. pd
  59. rt 90
  60. drawkey "A
  61. drawkey "B
  62. drawkey "C
  63. drawkey "D
  64. drawkey "E
  65. drawkey "F
  66. drawkey "G
  67. drawkey "A
  68. drawkey "B
  69. drawkey "C
  70. pu
  71. setxy -212 25
  72. pd
  73. drawkey "G#
  74. drawkey "A#
  75. drawkey "-
  76. drawkey "C#
  77. drawkey "D#
  78. drawkey "-
  79. drawkey "F#
  80. drawkey "G#
  81. drawkey "A#
  82. drawkey "-
  83. drawkey "C#
  84. end
  85.  
  86. to inst
  87. local "inst
  88. make "inst listboxgetselect "foo
  89. staticupdate "st4 fput "Instrument :inst
  90. midimessage (list 192+:chan first :inst 0)
  91. midimessage (list 192+:chan first :inst 0)
  92. setfocus [MswLogo Screen]
  93. end
  94.  
  95. to keydown
  96. local "thekey
  97. local "note
  98. make "thekey keyboardvalue
  99. make "note item :thekey :themap
  100. if not equalp :note -10 ~
  101.   [~
  102.   midimessage (list 144+:chan :octa+:note :velo)~
  103.   if :recording [recordmessage (list 144+:chan :octa+:note :velo)]~
  104.   ]
  105. end
  106.  
  107. to keyup
  108. local "thekey
  109. local "note
  110. make "thekey keyboardvalue
  111. make "note item :thekey :themap
  112. if not equalp :note -10 ~
  113.   [~
  114.   midimessage (list 144+:chan :octa+:note 0)~
  115.   if :recording [recordmessage (list 144+:chan :octa+:note 0)]~
  116.   ]
  117. end
  118.  
  119. to midi
  120. print midiopen
  121. (keyboardon [keydown] [keyup])
  122. windowcreate "root "main "main 0 0 185 185
  123. midisetup
  124. midiinit
  125. make "recording "false
  126. make "recordnotes array 1000
  127. make "recordcount 0
  128. end
  129.  
  130. to midiinit
  131. scrollbarset "sc1 1 127 1
  132. scrollbarset "sc2 1 127 1
  133. scrollbarset "sc3 1 16 3
  134. scrollbarset "sc4 1 11 6
  135. scrollbarset "sspeed 1 60 50
  136. listboxaddstring "foo [000 Acoustic Grand Piano]
  137. listboxaddstring "foo [001 Bright Acoustic Piano]
  138. listboxaddstring "foo [002 Electric Grand Piano]
  139. listboxaddstring "foo [003 Honky-tonk Piano]
  140. listboxaddstring "foo [004 Rhodes Piano]
  141. listboxaddstring "foo [005 Chorused Piano]
  142. listboxaddstring "foo [006 Harpsichord]
  143. listboxaddstring "foo [007 Clavinet]
  144. listboxaddstring "foo [008 Celesta]
  145. listboxaddstring "foo [009 Glockenspiel]
  146. listboxaddstring "foo [010 Music box]
  147. listboxaddstring "foo [011 Vibraphone]
  148. listboxaddstring "foo [012 Marimba]
  149. listboxaddstring "foo [013 Xylophone]
  150. listboxaddstring "foo [014 Tubular Bells]
  151. listboxaddstring "foo [015 Dulcimer]
  152. listboxaddstring "foo [016 Hammond Organ]
  153. listboxaddstring "foo [017 Percussive Organ]
  154. listboxaddstring "foo [018 Rock Organ]
  155. listboxaddstring "foo [019 Church Organ]
  156. listboxaddstring "foo [020 Reed Organ]
  157. listboxaddstring "foo [021 Accordian]
  158. listboxaddstring "foo [022 Harmonica]
  159. listboxaddstring "foo [023 Tango Accordian]
  160. listboxaddstring "foo [024 Acoustic Guitar (nylon)]
  161. listboxaddstring "foo [025 Acoustic Guitar (steel)]
  162. listboxaddstring "foo [026 Electric Guitar (jazz)]
  163. listboxaddstring "foo [027 Electric Guitar (clean)]
  164. listboxaddstring "foo [028 Electric Guitar (muted)]
  165. listboxaddstring "foo [029 Overdriven Guitar]
  166. listboxaddstring "foo [030 Distortion Guitar]
  167. listboxaddstring "foo [031 Guitar Harmonics]
  168. listboxaddstring "foo [032 Acoustic Bass]
  169. listboxaddstring "foo [033 Electric Bass (finger)]
  170. listboxaddstring "foo [034 Electric Bass (pick)]
  171. listboxaddstring "foo [035 Fretless Bass]
  172. listboxaddstring "foo [036 Slap Bass 1]
  173. listboxaddstring "foo [037 Slap Bass 2]
  174. listboxaddstring "foo [038 Synth Bass 1]
  175. listboxaddstring "foo [039 Synth Bass 2]
  176. listboxaddstring "foo [040 Violin]
  177. listboxaddstring "foo [041 Viola]
  178. listboxaddstring "foo [042 Cello]
  179. listboxaddstring "foo [043 Contrabass]
  180. listboxaddstring "foo [044 Tremolo Strings]
  181. listboxaddstring "foo [045 Pizzicato Strings]
  182. listboxaddstring "foo [046 Orchestral Harp]
  183. listboxaddstring "foo [047 Timpani]
  184. listboxaddstring "foo [048 String Ensemble 1]
  185. listboxaddstring "foo [049 String Ensemble 2]
  186. listboxaddstring "foo [050 Synth Strings 1]
  187. listboxaddstring "foo [051 Synth Strings 2]
  188. listboxaddstring "foo [052 Choir Aahs]
  189. listboxaddstring "foo [053 Voice Oohs]
  190. listboxaddstring "foo [054 Synth Voice]
  191. listboxaddstring "foo [055 Orchestra Hit]
  192. listboxaddstring "foo [056 Trumpet]
  193. listboxaddstring "foo [057 Trombone]
  194. listboxaddstring "foo [058 Tuba]
  195. listboxaddstring "foo [059 Muted Trumpet]
  196. listboxaddstring "foo [060 French Horn]
  197. listboxaddstring "foo [061 Brass Section]
  198. listboxaddstring "foo [062 Synth Brass 1]
  199. listboxaddstring "foo [063 Synth Brass 2]
  200. listboxaddstring "foo [064 Soprano Sax]
  201. listboxaddstring "foo [065 Alto Sax]
  202. listboxaddstring "foo [066 Tenor Sax]
  203. listboxaddstring "foo [067 Baritone Sax]
  204. listboxaddstring "foo [068 Oboe]
  205. listboxaddstring "foo [069 English Horn]
  206. listboxaddstring "foo [070 Bassoon]
  207. listboxaddstring "foo [071 Clarinet]
  208. listboxaddstring "foo [072 Piccolo]
  209. listboxaddstring "foo [073 Flute]
  210. listboxaddstring "foo [074 Recorder]
  211. listboxaddstring "foo [075 Pan Flute]
  212. listboxaddstring "foo [076 Bottle Blow]
  213. listboxaddstring "foo [077 Shakuhachi]
  214. listboxaddstring "foo [078 Whistle]
  215. listboxaddstring "foo [079 Ocarina]
  216. listboxaddstring "foo [080 Lead 1 (square)]
  217. listboxaddstring "foo [081 Lead 2 (sawtooth)]
  218. listboxaddstring "foo [082 Lead 3 (caliope lead)]
  219. listboxaddstring "foo [083 Lead 4 (chiff lead)]
  220. listboxaddstring "foo [084 Lead 5 (charang)]
  221. listboxaddstring "foo [085 Lead 6 (voice)]
  222. listboxaddstring "foo [086 Lead 7 (fifths)]
  223. listboxaddstring "foo [087 Lead 8 (brass + lead)]
  224. listboxaddstring "foo [088 Pad 1 (new age)]
  225. listboxaddstring "foo [089 Pad 2 (warm)]
  226. listboxaddstring "foo [090 Pad 3 (polysynth)]
  227. listboxaddstring "foo [091 Pad 4 (choir)]
  228. listboxaddstring "foo [092 Pad 5 (bowed)]
  229. listboxaddstring "foo [093 Pad 6 (metallic)]
  230. listboxaddstring "foo [094 Pad 7 (halo)]
  231. listboxaddstring "foo [095 Pad 8 (sweep)]
  232. listboxaddstring "foo [096 FX 1 (rain)]
  233. listboxaddstring "foo [097 FX 2 (soundtrack)]
  234. listboxaddstring "foo [098 FX 3 (crystal)]
  235. listboxaddstring "foo [099 FX 4 (atmosphere)]
  236. listboxaddstring "foo [100 FX 5 (brightness)]
  237. listboxaddstring "foo [101 FX 6 (goblins)]
  238. listboxaddstring "foo [102 FX 7 (echoes)]
  239. listboxaddstring "foo [103 FX 8 (sci-fi)]
  240. listboxaddstring "foo [104 Sitar]
  241. listboxaddstring "foo [105 Banjo]
  242. listboxaddstring "foo [106 Shamisen]
  243. listboxaddstring "foo [107 Koto]
  244. listboxaddstring "foo [108 Kalimba]
  245. listboxaddstring "foo [109 Bagpipe]
  246. listboxaddstring "foo [110 Fiddle]
  247. listboxaddstring "foo [111 Shanai]
  248. listboxaddstring "foo [112 Tinkle Bell]
  249. listboxaddstring "foo [113 Agogo]
  250. listboxaddstring "foo [114 Steel Drums]
  251. listboxaddstring "foo [115 Woodblock]
  252. listboxaddstring "foo [116 Taiko Drum]
  253. listboxaddstring "foo [117 Melodic Tom]
  254. listboxaddstring "foo [118 Synth Drum]
  255. listboxaddstring "foo [119 Reverse Cymbal]
  256. listboxaddstring "foo [120 Guitar Fret Noise]
  257. listboxaddstring "foo [121 Breath Noise]
  258. listboxaddstring "foo [122 Seashore]
  259. listboxaddstring "foo [123 Bird Tweet]
  260. listboxaddstring "foo [124 Telephone Ring]
  261. listboxaddstring "foo [125 Helicopter]
  262. listboxaddstring "foo [126 Applause]
  263. listboxaddstring "foo [127 Gunshot]
  264. chan
  265. volu
  266. velo
  267. octa
  268. inst
  269. changespeed
  270. make "themap array 256
  271. repeat 256 [setitem repcount :themap -10]
  272. setitem 65  :themap -4
  273. setitem 90  :themap -